package com.ir.stat.spark.config;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ApplicationProperties {


    @Bean
    public PropertyPlaceholderConfigurer properties() {
        final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
        ppc.setIgnoreResourceNotFound(true);
        final List<Resource> list = new ArrayList<Resource>();
        list.add(new ClassPathResource("application.properties"));
        ppc.setLocations(list.toArray(new Resource[]{}));
        ppc.setFileEncoding("utf-8");
        return ppc;
    }
}